package udpInvoker.test;


import udpInvoker.main.ServiceDescription;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 * User: esr
 * Date: 08.okt.2008
 * Time: 16:53:52
 * Copyright 2008  Espen Skjervold, FFI
 */

import udpInvoker.main.lib.Invoker;

public class InvokerTester {

    public InvokerTester() {

        Invoker invoker = new Invoker();

        try {

            //int response = (Integer) invoker.invoke("add", 5, 10);

            //System.out.println("Response is: " + response);

            //Object response = invoker.invoke("multiply", new Double(100), new Double(4));


            ServiceDescription[] services = invoker.discoverServices();

            int x=0;


            ArrayList list = new ArrayList();
            Random random =new Random();
            for (int i=0;i<1000;i++) {
                list.add(random.nextLong()+"");
            }

            //Object response = invoker.invokeSecure("MyInvokable.sort", "detteerethemmeligpassordjanettopp", list);

            for (int i=0;i<5;i++) {
                Object response = invoker.invoke("MyInvokable.sort", list);

                System.out.println("Result: " + response);
                //Thread.sleep(500);
            }
            
        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }


    }

    public static void main(String[] args) {

        new InvokerTester();

    }


}
